﻿@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
    $min: breakpoint-min($name, $breakpoints);

    @if $min {
        @media (min-width: $min) {
            @content;
        }
    }
    @else {
        @content;
    }
}

@mixin tablet($min-width: $tablet) {
    @media screen and (min-width: $min-width), print {
        @content;
    }
}

@mixin overflow-touch () {
    -webkit-overflow-scrolling: touch;
}

// source: https://github.com/Wikiki/bulma-switch
@mixin switch-size($size) {
    $switch-height: $size * 1.5;
    $switch-width: $switch-height * 2;
    $paddle-height: $switch-height - ($switch-paddle-offset * 2);
    $paddle-width: $switch-height - ($switch-paddle-offset * 2);
    $paddle-active-offest: $switch-width - $paddle-width - ($switch-paddle-offset * 1.5);

    + label {
        position: relative;
        display: initial;
        font-size: $size;
        line-height: $control-line-height;
        padding-left: $switch-width + .5;
        padding-top: .2rem;
        cursor: pointer;

        &::before, &:before {
            position: absolute;
            display: block;
            top: calc( 50% - #{$switch-height} / 2 );
            left: 0;
            width: $switch-width;
            height: $switch-height;
            border: $switch-border;
            border-radius: $switch-radius;
            background: $switch-background;
            content: '';
        }

        &::after, &:after {
            display: block;
            position: absolute;
            top: calc( 50% - #{$paddle-height} / 2 );
            left: $switch-paddle-offset;
            width: $paddle-width;
            height: $paddle-height;
            transform: translate3d(0, 0, 0);
            border-radius: $switch-radius;
            background: $switch-paddle-background;
            transition: $switch-paddle-transition;
            content: '';
        }
    }

    &:checked {
        + label {
            &::before, &:before {
                background: $switch-background-active;
            }

            &::after {
                left: $paddle-active-offest;
            }
        }
    }
}

@mixin block($spacing: $block-spacing) {
    &:not(:last-child) {
        margin-bottom: $spacing;
    }
}
